﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using log4net.Config;
using mtgtoolbox.Controls.CollectionList.ViewModels;
using mtgtoolbox.Views;
using Castle.MicroKernel;
using mtgtoolbox.ViewModels;

namespace mtgtoolbox
{
  public partial class MainWindow : Window
  {
    private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(MainWindow));

    private IKernel kernel;
    public MainWindow(IKernel kernel)
    {
      InitializeComponent();

      this.kernel = kernel;

      // Make the window moveable
      //
      this.MouseLeftButtonDown += delegate { this.DragMove(); };

      // Set the collection tab as the active tab
      //
      kernel.Resolve<ICollectionsViewModel>().OpenCollection("Default");
      viewPane.Children.Add(kernel.Resolve<CollectionsView>());
    }

    private void closeBtn_Click(object sender, RoutedEventArgs e)
    {
      this.Close();
    }

    private void collectionBtn_Click(object sender, RoutedEventArgs e)
    {
      viewPane.Children.Clear();
      viewPane.Children.Add(kernel.Resolve<CollectionsView>());
    }

    private void settingsBtn_Click(object sender, RoutedEventArgs e)
    {
      viewPane.Children.Clear();
      viewPane.Children.Add(kernel.Resolve<SettingsView>());
    }

    private void aboutBtn_Click(object sender, RoutedEventArgs e)
    {
      viewPane.Children.Clear();
      viewPane.Children.Add(kernel.Resolve<AboutView>());
    }


  }
}
